package com.jasic.util;

import android.hardware.Camera;

import java.util.Comparator;

/**
 * Created with IntelliJ IDEA.
 * User: Jasic
 * Date: 12-11-26
 */
public class SizeComparator implements Comparator<Camera.Size>{


     /**
     * 根据总像素进行大小判断
     * @param another
     * @return
     */
    @Override
    public int compare(Camera.Size lhs, Camera.Size rhs) {

        int totalPix_1 = lhs.height * lhs.width;

        int totalPix_2 = rhs.height * rhs.width;

        return totalPix_1 - totalPix_2;
    }
}
